home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3773 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: airdmhor.gen.nz!not-for-mail
  2. From: gumboot@airdmhor.gen.nz (Simon Hosie)
  3. Newsgroups: comp.lang.c
  4. Subject: What's wrong here?
  5. Date: 31 Jan 1996 15:46:16 +1300
  6. Organization: Airdmhor
  7. Message-ID: <4eml5o$o6h@airdmhor.gen.nz>
  8. NNTP-Posting-Host: localhost.gen.nz
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11.    1: #include <stdio.h>
  12.    2: 
  13.    3: typedef unsigned short word;
  14.    4: 
  15.    5: int main(void)
  16.    6: {
  17.    7:     word a, b, c, d;
  18.    8: 
  19.    9:     a = 1;
  20.   10:     b = 2;
  21.   11:     c = 4;
  22.   12:     d = a | b | c;
  23.   13: 
  24.   14:     d |= a;
  25.   15: 
  26.   16:     d |= a | b;
  27.   17:     d = d | a | b;
  28.   18: 
  29.   19:     return 0;
  30.   20: }
  31.  
  32.   Watcom gives the following warnings (and _only_ those warnings) compiling
  33. the above code (except without the line numbers or colons), but only when
  34. it's compiling it as C++ and generating 32 bit code (GCC doesn't, no matter
  35. how hard I try).  I don't know C++ myself, but my flatmate is learning it,
  36. does it have anything to do with the typedef?
  37.  
  38. TEST.CPP(12): Warning! W389: (col 15) integral value may be truncated during 
  39.               assignment or initialization 
  40. TEST.CPP(17): Warning! W389: (col 15) integral value may be truncated during
  41.               assignment or initialization 
  42.